<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>蓝图 | 课程简介</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../C03-RequestAndResponse/index.html" />
    
    
    <link rel="prev" href="../C02-RouterAndBlueprint/Router.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="3.2"
        data-chapter-title="蓝图"
        data-filepath="C02-RouterAndBlueprint/Blueprint.md"
        data-basepath=".."
        data-revision="Sat May 11 2019 20:06:35 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        课程简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="AboutFlask.html">
            
                
                    <a href="../AboutFlask.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Flask介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="C01-CreateProject/index.html">
            
                
                    <a href="../C01-CreateProject/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        工程搭建
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="C01-CreateProject/EnvInstall.html">
            
                
                    <a href="../C01-CreateProject/EnvInstall.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        环境安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="C01-CreateProject/HelloWorld.html">
            
                
                    <a href="../C01-CreateProject/HelloWorld.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        HelloWorld程序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="C01-CreateProject/AboutParams.html">
            
                
                    <a href="../C01-CreateProject/AboutParams.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        参数说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="C01-CreateProject/StartDevelopmentServer.html">
            
                
                    <a href="../C01-CreateProject/StartDevelopmentServer.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        开发服务器运行方式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="C02-RouterAndBlueprint/index.html">
            
                
                    <a href="../C02-RouterAndBlueprint/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        路由与蓝图
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="C02-RouterAndBlueprint/Router.html">
            
                
                    <a href="../C02-RouterAndBlueprint/Router.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        路由
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.2" data-path="C02-RouterAndBlueprint/Blueprint.html">
            
                
                    <a href="../C02-RouterAndBlueprint/Blueprint.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        蓝图
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="C03-RequestAndResponse/index.html">
            
                
                    <a href="../C03-RequestAndResponse/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        请求与响应
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="C03-RequestAndResponse/HandleRequest.html">
            
                
                    <a href="../C03-RequestAndResponse/HandleRequest.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        处理请求
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="C03-RequestAndResponse/HandleResponse.html">
            
                
                    <a href="../C03-RequestAndResponse/HandleResponse.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        处理响应
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="C03-RequestAndResponse/CookieAndSession.html">
            
                
                    <a href="../C03-RequestAndResponse/CookieAndSession.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        Cookie与Session
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="C04-HookAndContext/index.html">
            
                
                    <a href="../C04-HookAndContext/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        请求钩子与上下文
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="C04-HookAndContext/AbortAndErrorhandler.html">
            
                
                    <a href="../C04-HookAndContext/AbortAndErrorhandler.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        异常处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="C04-HookAndContext/Hook.html">
            
                
                    <a href="../C04-HookAndContext/Hook.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        请求钩子
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="C04-HookAndContext/Context.html">
            
                
                    <a href="../C04-HookAndContext/Context.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        上下文
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="C05-Flask-RESTful/index.html">
            
                
                    <a href="../C05-Flask-RESTful/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        Flask-RESTful
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="C05-Flask-RESTful/QuickStart.html">
            
                
                    <a href="../C05-Flask-RESTful/QuickStart.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        起步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="C05-Flask-RESTful/AboutView.html">
            
                
                    <a href="../C05-Flask-RESTful/AboutView.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        关于视图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="C05-Flask-RESTful/AboutRequest.html">
            
                
                    <a href="../C05-Flask-RESTful/AboutRequest.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        关于请求
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="C05-Flask-RESTful/AboutResponse.html">
            
                
                    <a href="../C05-Flask-RESTful/AboutResponse.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        关于响应
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >课程简介</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x84DD;&#x56FE;">&#x84DD;&#x56FE;</h1>
<h2 id="&#x9700;&#x6C42;">&#x9700;&#x6C42;</h2>
<p>&#x5728;&#x4E00;&#x4E2A;Flask &#x5E94;&#x7528;&#x9879;&#x76EE;&#x4E2D;&#xFF0C;&#x5982;&#x679C;&#x4E1A;&#x52A1;&#x89C6;&#x56FE;&#x8FC7;&#x591A;&#xFF0C;&#x53EF;&#x5426;&#x5C06;&#x4EE5;&#x67D0;&#x79CD;&#x65B9;&#x5F0F;&#x5212;&#x5206;&#x51FA;&#x7684;&#x4E1A;&#x52A1;&#x5355;&#x5143;&#x5355;&#x72EC;&#x7EF4;&#x62A4;&#xFF0C;&#x5C06;&#x6BCF;&#x4E2A;&#x5355;&#x5143;&#x7528;&#x5230;&#x7684;&#x89C6;&#x56FE;&#x3001;&#x9759;&#x6001;&#x6587;&#x4EF6;&#x3001;&#x6A21;&#x677F;&#x6587;&#x4EF6;&#x7B49;&#x72EC;&#x7ACB;&#x5206;&#x5F00;&#xFF1F;</p>
<p>&#x4F8B;&#x5982;&#x4ECE;&#x4E1A;&#x52A1;&#x89D2;&#x5EA6;&#x4E0A;&#xFF0C;&#x53EF;&#x5C06;&#x6574;&#x4E2A;&#x5E94;&#x7528;&#x5212;&#x5206;&#x4E3A;&#x7528;&#x6237;&#x6A21;&#x5757;&#x5355;&#x5143;&#x3001;&#x5546;&#x54C1;&#x6A21;&#x5757;&#x5355;&#x5143;&#x3001;&#x8BA2;&#x5355;&#x6A21;&#x5757;&#x5355;&#x5143;&#xFF0C;&#x5982;&#x4F55;&#x5206;&#x522B;&#x5F00;&#x53D1;&#x8FD9;&#x4E9B;&#x4E0D;&#x540C;&#x5355;&#x5143;&#xFF0C;&#x5E76;&#x6700;&#x7EC8;&#x6574;&#x5408;&#x5230;&#x4E00;&#x4E2A;&#x9879;&#x76EE;&#x5E94;&#x7528;&#x4E2D;&#xFF1F;</p>
<p>&#x5728;Django&#x4E2D;&#x8FD9;&#x79CD;&#x9700;&#x6C42;&#x662F;&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#x7684;&#xFF1F;</p>
<h2 id="&#x84DD;&#x56FE;">&#x84DD;&#x56FE;</h2>
<p>&#x5728;Flask&#x4E2D;&#xFF0C;&#x4F7F;&#x7528;&#x84DD;&#x56FE;Blueprint&#x6765;&#x5206;&#x6A21;&#x5757;&#x7EC4;&#x7EC7;&#x7BA1;&#x7406;&#x3002;</p>
<p>&#x84DD;&#x56FE;&#x5B9E;&#x9645;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;&#x662F;&#x4E00;&#x4E2A;&#x5B58;&#x50A8;&#x4E00;&#x7EC4;&#x89C6;&#x56FE;&#x65B9;&#x6CD5;&#x7684;&#x5BB9;&#x5668;&#x5BF9;&#x8C61;&#xFF0C;&#x5176;&#x5177;&#x6709;&#x5982;&#x4E0B;&#x7279;&#x70B9;&#xFF1A;</p>
<ul>
<li>&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#x53EF;&#x4EE5;&#x5177;&#x6709;&#x591A;&#x4E2A;Blueprint</li>
<li>&#x53EF;&#x4EE5;&#x5C06;&#x4E00;&#x4E2A;Blueprint&#x6CE8;&#x518C;&#x5230;&#x4EFB;&#x4F55;&#x4E00;&#x4E2A;&#x672A;&#x4F7F;&#x7528;&#x7684;URL&#x4E0B;&#x6BD4;&#x5982; &#x201C;/user&#x201D;&#x3001;&#x201C;/goods&#x201D;</li>
<li>Blueprint&#x53EF;&#x4EE5;&#x5355;&#x72EC;&#x5177;&#x6709;&#x81EA;&#x5DF1;&#x7684;&#x6A21;&#x677F;&#x3001;&#x9759;&#x6001;&#x6587;&#x4EF6;&#x6216;&#x8005;&#x5176;&#x5B83;&#x7684;&#x901A;&#x7528;&#x64CD;&#x4F5C;&#x65B9;&#x6CD5;&#xFF0C;&#x5B83;&#x5E76;&#x4E0D;&#x662F;&#x5FC5;&#x987B;&#x8981;&#x5B9E;&#x73B0;&#x5E94;&#x7528;&#x7684;&#x89C6;&#x56FE;&#x548C;&#x51FD;&#x6570;&#x7684;</li>
<li>&#x5728;&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#x521D;&#x59CB;&#x5316;&#x65F6;&#xFF0C;&#x5C31;&#x5E94;&#x8BE5;&#x8981;&#x6CE8;&#x518C;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x7684;Blueprint</li>
</ul>
<p>&#x4F46;&#x662F;&#x4E00;&#x4E2A;Blueprint&#x5E76;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x5B8C;&#x6574;&#x7684;&#x5E94;&#x7528;&#xFF0C;&#x5B83;&#x4E0D;&#x80FD;&#x72EC;&#x7ACB;&#x4E8E;&#x5E94;&#x7528;&#x8FD0;&#x884C;&#xFF0C;&#x800C;&#x5FC5;&#x987B;&#x8981;&#x6CE8;&#x518C;&#x5230;&#x67D0;&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#x4E2D;&#x3002;</p>
<h2 id="&#x4F7F;&#x7528;&#x65B9;&#x5F0F;">&#x4F7F;&#x7528;&#x65B9;&#x5F0F;</h2>
<p>&#x4F7F;&#x7528;&#x84DD;&#x56FE;&#x53EF;&#x4EE5;&#x5206;&#x4E3A;&#x4E09;&#x4E2A;&#x6B65;&#x9AA4;</p>
<ol>
<li><p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x84DD;&#x56FE;&#x5BF9;&#x8C61;</p>
<pre><code class="lang-python"> user_bp=Blueprint(<span class="hljs-string">&apos;user&apos;</span>,__name__)
</code></pre>
</li>
<li><p>&#x5728;&#x8FD9;&#x4E2A;&#x84DD;&#x56FE;&#x5BF9;&#x8C61;&#x4E0A;&#x8FDB;&#x884C;&#x64CD;&#x4F5C;,&#x6CE8;&#x518C;&#x8DEF;&#x7531;,&#x6307;&#x5B9A;&#x9759;&#x6001;&#x6587;&#x4EF6;&#x5939;,&#x6CE8;&#x518C;&#x6A21;&#x7248;&#x8FC7;&#x6EE4;&#x5668;</p>
<pre><code class="lang-python"><span class="hljs-decorator"> @user_bp.route(&apos;/&apos;)</span>
 <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">user_profile</span><span class="hljs-params">()</span>:</span>
     <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;user_profile&apos;</span>
</code></pre>
</li>
<li><p>&#x5728;&#x5E94;&#x7528;&#x5BF9;&#x8C61;&#x4E0A;&#x6CE8;&#x518C;&#x8FD9;&#x4E2A;&#x84DD;&#x56FE;&#x5BF9;&#x8C61;</p>
<pre><code class="lang-python"> app.register_blueprint(user_bp)
</code></pre>
</li>
</ol>
<h4 id="&#x5355;&#x6587;&#x4EF6;&#x84DD;&#x56FE;">&#x5355;&#x6587;&#x4EF6;&#x84DD;&#x56FE;</h4>
<p>&#x53EF;&#x4EE5;&#x5C06;&#x521B;&#x5EFA;&#x84DD;&#x56FE;&#x5BF9;&#x8C61;&#x4E0E;&#x5B9A;&#x4E49;&#x89C6;&#x56FE;&#x653E;&#x5230;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x4E2D; &#x3002;</p>
<h4 id="&#x76EE;&#x5F55;&#xFF08;&#x5305;&#xFF09;&#x84DD;&#x56FE;">&#x76EE;&#x5F55;&#xFF08;&#x5305;&#xFF09;&#x84DD;&#x56FE;</h4>
<p>&#x5BF9;&#x4E8E;&#x4E00;&#x4E2A;&#x6253;&#x7B97;&#x5305;&#x542B;&#x591A;&#x4E2A;&#x6587;&#x4EF6;&#x7684;&#x84DD;&#x56FE;&#xFF0C;&#x901A;&#x5E38;&#x5C06;&#x521B;&#x5EFA;&#x84DD;&#x56FE;&#x5BF9;&#x8C61;&#x653E;&#x5230;Python&#x5305;&#x7684;<code>__init__.py</code>&#x6587;&#x4EF6;&#x4E2D;</p>
<pre><code class="lang-shell">--------- project # &#x5DE5;&#x7A0B;&#x76EE;&#x5F55;
  |------ main.py # &#x542F;&#x52A8;&#x6587;&#x4EF6;
  |------ user  #&#x7528;&#x6237;&#x84DD;&#x56FE;
  |  |--- __init__.py  # &#x6B64;&#x5904;&#x521B;&#x5EFA;&#x84DD;&#x56FE;&#x5BF9;&#x8C61;
  |  |--- passport.py  
  |  |--- profile.py
  |  |--- ...
  |
  |------ goods # &#x5546;&#x54C1;&#x84DD;&#x56FE;
  |  |--- __init__.py
  |  |--- ...
  |...
</code></pre>
<h2 id="&#x6269;&#x5C55;&#x7528;&#x6CD5;">&#x6269;&#x5C55;&#x7528;&#x6CD5;</h2>
<h4 id="1-&#x6307;&#x5B9A;&#x84DD;&#x56FE;&#x7684;url&#x524D;&#x7F00;">1 &#x6307;&#x5B9A;&#x84DD;&#x56FE;&#x7684;url&#x524D;&#x7F00;</h4>
<p>&#x5728;&#x5E94;&#x7528;&#x4E2D;&#x6CE8;&#x518C;&#x84DD;&#x56FE;&#x65F6;&#x4F7F;&#x7528;<code>url_prefix</code>&#x53C2;&#x6570;&#x6307;&#x5B9A;</p>
<pre><code class="lang-python">app.register_blueprint(user_bp, url_prefix=<span class="hljs-string">&apos;/user&apos;</span>)
app.register_blueprint(goods_bp, url_prefix=<span class="hljs-string">&apos;/goods&apos;</span>)
</code></pre>
<h4 id="2-&#x84DD;&#x56FE;&#x5185;&#x90E8;&#x9759;&#x6001;&#x6587;&#x4EF6;">2 &#x84DD;&#x56FE;&#x5185;&#x90E8;&#x9759;&#x6001;&#x6587;&#x4EF6;</h4>
<p>&#x548C;&#x5E94;&#x7528;&#x5BF9;&#x8C61;&#x4E0D;&#x540C;&#xFF0C;&#x84DD;&#x56FE;&#x5BF9;&#x8C61;&#x521B;&#x5EFA;&#x65F6;&#x4E0D;&#x4F1A;&#x9ED8;&#x8BA4;&#x6CE8;&#x518C;&#x9759;&#x6001;&#x76EE;&#x5F55;&#x7684;&#x8DEF;&#x7531;&#x3002;&#x9700;&#x8981;&#x6211;&#x4EEC;&#x5728; &#x521B;&#x5EFA;&#x65F6;&#x6307;&#x5B9A; static_folder &#x53C2;&#x6570;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x5C06;&#x84DD;&#x56FE;&#x6240;&#x5728;&#x76EE;&#x5F55;&#x4E0B;&#x7684;static_admin&#x76EE;&#x5F55;&#x8BBE;&#x7F6E;&#x4E3A;&#x9759;&#x6001;&#x76EE;&#x5F55;</p>
<pre><code class="lang-python">admin = Blueprint(<span class="hljs-string">&quot;admin&quot;</span>,__name__,static_folder=<span class="hljs-string">&apos;static_admin&apos;</span>)
app.register_blueprint(admin,url_prefix=<span class="hljs-string">&apos;/admin&apos;</span>)
</code></pre>
<p>&#x73B0;&#x5728;&#x5C31;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>/admin/static_admin/&lt;filename&gt;</code>&#x8BBF;&#x95EE;<code>static_admin</code>&#x76EE;&#x5F55;&#x4E0B;&#x7684;&#x9759;&#x6001;&#x6587;&#x4EF6;&#x4E86;&#x3002;</p>
<p>&#x4E5F;&#x53EF;&#x901A;&#x8FC7;<code>static_url_path</code>&#x6539;&#x53D8;&#x8BBF;&#x95EE;&#x8DEF;&#x5F84;</p>
<pre><code class="lang-python">admin = Blueprint(<span class="hljs-string">&quot;admin&quot;</span>,__name__,static_folder=<span class="hljs-string">&apos;static_admin&apos;</span>,static_url_path=<span class="hljs-string">&apos;/lib&apos;</span>)
app.register_blueprint(admin,url_prefix=<span class="hljs-string">&apos;/admin&apos;</span>)
</code></pre>
<h4 id="3-&#x84DD;&#x56FE;&#x5185;&#x90E8;&#x6A21;&#x677F;&#x76EE;&#x5F55;">3 &#x84DD;&#x56FE;&#x5185;&#x90E8;&#x6A21;&#x677F;&#x76EE;&#x5F55;</h4>
<p>&#x84DD;&#x56FE;&#x5BF9;&#x8C61;&#x9ED8;&#x8BA4;&#x7684;&#x6A21;&#x677F;&#x76EE;&#x5F55;&#x4E3A;&#x7CFB;&#x7EDF;&#x7684;&#x6A21;&#x7248;&#x76EE;&#x5F55;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x521B;&#x5EFA;&#x84DD;&#x56FE;&#x5BF9;&#x8C61;&#x65F6;&#x4F7F;&#x7528; template_folder &#x5173;&#x952E;&#x5B57;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&#x6A21;&#x677F;&#x76EE;&#x5F55;</p>
<pre><code class="lang-python">admin = Blueprint(<span class="hljs-string">&apos;admin&apos;</span>,__name__,template_folder=<span class="hljs-string">&apos;my_templates&apos;</span>)
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../C02-RouterAndBlueprint/Router.html" class="navigation navigation-prev " aria-label="Previous page: 路由"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../C03-RequestAndResponse/index.html" class="navigation navigation-next " aria-label="Next page: 请求与响应"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
